home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / diskmags / 3565-4.665 / dmg-4180 / a / a11.doc < prev    next >
Text File  |  1987-04-21  |  1KB  |  68 lines

  1.  
  2.                ROBOTICS
  3.                ********
  4.  
  5.            By Matthew Green.
  6.            *****************
  7.  
  8.  
  9. Input/Output Port 
  10. -----------------
  11. Part 2
  12. ------
  13.  
  14.  Last time I showed you how to light up
  15. each L.E.D on the port. If you have
  16. tried it and have tried changing the
  17. 'chr$' number you would have seen some
  18. strange effects.
  19.  
  20.  To turn on each pin you have to change
  21. the number in the brackets, e.g.
  22.  
  23.  CHR$(1) = turn on light one
  24.  CHR$(2) = turn on light two
  25.  
  26.  Now you may think that it is going up
  27. in one's but it needs to be doubled
  28. each time you want the next light to
  29. turn on, e.g.
  30.  
  31.  CHR$(4) = turn on light 3
  32.  CHR$(8) = turn on light 4
  33.  
  34. and so on... all the way up to (128)
  35. for light 8.
  36.  You may be wondering what the numbers
  37. in between do. Well, I will tell you.
  38.  
  39.  PRINT #1,CHR$(3)
  40.  
  41.  If you did the above line in last
  42. month's program you will see light
  43. number 1 come on and also light number
  44. 2 come on. If you can't figure out why
  45. it did this then read the next line...
  46.  
  47.  You add the CHR$ of each light
  48. together and then print that. If you
  49. printed the number '255' it would turn
  50. all the lights on.
  51.  
  52.  Well that's the end of this short
  53. lesson. Try and see if you can make a
  54. program to turn each light on one after
  55. each other, leaving the ones before on.
  56.  
  57.  I will tell you how to do this in the
  58. next article.
  59.  
  60.  
  61.  Matthew Green.
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.